/*
 * @Author       : wfl
 * @LastEditors: wfl
 * @description  :
 * @updateInfo   :
 * @Date         : 2023-02-27 09:41:26
 * @LastEditTime: 2023-04-14 10:19:23
 */
import { setupLayouts } from 'virtual:generated-layouts'
import generatedRoutes from 'virtual:generated-pages'
import type { Route } from '@g/types/global'
import { constantRoutes, systemRoutes } from './system-routes'
import frameworkRoutes from './frame-work'

// 动态路由（异步路由、导航栏路由）
const asyncRoutes: Route.recordMainRaw[] = []

// 根据views文件目录生成路由(基于文件系统生成路由)
const constantRoutesByFilesystem = generatedRoutes.filter(item => {
  return item.meta?.enabled !== false && item.meta?.constant === true
})
const asyncRoutesByFilesystem = setupLayouts(generatedRoutes.filter(item => {
  return item.meta?.enabled !== false && item.meta?.constant !== true && item.meta?.layout !== false
}))

export {
  frameworkRoutes,
  constantRoutes,
  systemRoutes,
  asyncRoutes,
  constantRoutesByFilesystem,
  asyncRoutesByFilesystem
}
